package org.liveboardgames.common.utils.collections
{
    import org.liveboardgames.agricola.vo.action.Action;
    
    import mx.collections.ListCollectionView;
    
    public class ContainUtil
    {
        public static function getActionIndex(list:ListCollectionView, comparedToAction:Action):int
        {
            // If the action is present in the list, no problem
            var result:int = list.getItemIndex(comparedToAction);
            
            // If not, we need to check more precisely
            if (result == -1)
            {
                for each (var action:Action in list)
                {
                    if (action.equals(comparedToAction))
                    {
                        result = list.getItemIndex(action);
                    }
                }
            }
            
            return result;
        }
    
    }
}